# -*- coding: UTF-8 -*-
# @Project ：luffycity 
# @File    ：变量.py
# @Author  ：于金龙
# @IDE     ：PyCharm 
# @Date    ：2024/4/10 9:16
class Person(object):
    country = '中国'

    def __init__(self, name, age):
        self.name = name
        self.age = age

    def show(self):
        message = "{} is {} years old".format(self.name, self.age)
        print(message)


print(Person.country)  # 使用类获取类变量
P1 = Person('于金龙', 21)
print(P1.country)  # 使用对象获取类变量
P1.country = "china"
P1.age = 22
print(P1.country)  # china
print(P1.age)  # 22
Person.country = "中国1"
print(Person.country)  # 中国1
